<script type="text/html" template lay-done="layui.data.done(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsPages-createForm" id="LAY-app-CoreCmsPages-createForm">

        <div class="layui-form-item">
            <label for="code" class="layui-form-label  layui-form-required">区域编码</label>
            <div class="layui-input-inline">
                <input name="code" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入区域编码" placeholder="请输入区域编码" />
            </div>
            <div class="layui-form-mid layui-word-aux">只能为英文,添加后不能修改</div>
        </div>

        <div class="layui-form-item">
            <label for="name" class="layui-form-label  layui-form-required">区域名称</label>
            <div class="layui-input-inline">
                <input name="name" lay-verType="tips" lay-verify="required|verifyname" class="layui-input" lay-reqText="请输入区域名称" placeholder="请输入区域名称" />
            </div>
            <div class="layui-form-mid layui-word-aux">中文名称</div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="description" class="layui-form-label  layui-form-required">描述</label>
            <div class="layui-input-block">
                <textarea name="description" lay-verType="tips" lay-verify="required|verifydescription" class="layui-textarea" lay-reqText="请输入描述" placeholder="请输入描述" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="layout" class="layui-form-label  layui-form-required">布局样式</label>
            <div class="layui-input-block">
                <select name="layout" required lay-verType="tips" lay-verify="required" lay-reqText="请选择布局样式" placeholder="请选择布局样式">
                    <option value="">请选择</option>
                    {{# layui.each(d.params.data.pagesLayout, function(index, item){ }}
                    <option value="{{ item.value }}">{{ item.description }}</option>
                    {{# }); }}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="type" class="layui-form-label  layui-form-required">类型</label>
            <div class="layui-input-block">
                <select name="type" required lay-verType="tips" lay-verify="required" lay-reqText="请选择类型" placeholder="请选择类型">
                    <option value="">请选择</option>
                    {{# layui.each(d.params.data.pagesType, function(index, item){ }}
                    <option value="{{ item.value }}">{{ item.description }}</option>
                    {{# }); }}
                </select>
            </div>
        </div>

        <div class="layui-form-item text-right">
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsPages-createForm-submit" id="LAY-app-CoreCmsPages-createForm-submit" value="确认添加">
        </div>
    </div>
</script>
<script>
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , coreHelper = layui.coreHelper;

                form.verify({

                    verifycode: [/^.{0,25}$/, '区域编码最大只允许输入25位字符'],
                    verifyname: [/^.{0,25}$/, '区域名称最大只允许输入25位字符'],
                    verifydescription: [/^.{0,127}$/, '描述最大只允许输入127位字符'],
                });
                //重载form
                form.render(null, 'LAY-app-CoreCmsPages-createForm');
            })
    };
</script>
